<template>
  <div class="home">
    <el-container>
      <el-aside width="200">
        <el-menu :default-active="$route.path"
                 class="el-menu-vertical-demo"
                 :router="true"
                 :collapse="isCollapse">
          <qf-sub-menu :sideMenu="menuList"></qf-sub-menu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <el-row type="flex"
                  class="row-bg"
                  justify="space-between">
            <el-col :span="6">
              <div class="grid-content">
                <i class="iconfont icon-shouqi"
                   @click="isCollapse=!isCollapse"></i>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="grid-content">
                后台管理系统
              </div>
            </el-col>
            <el-col :span="6">
              <div class="grid-content">
                <el-avatar :size="40"
                           fit="fit"
                           src="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2100809072,960054998&fm=26&gp=0.jpg"></el-avatar>
                <span>欢迎您:</span>
                <b class="nickname">{{userInfo.nickname}}</b>
                <span class="quit"
                      @click="quit">退出</span>
              </div>
            </el-col>
          </el-row>
        </el-header>
        <el-main>
      
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script>
  import { getLoginLog } from "@/api"
  import subMenu from '../../components/subMenu'
  import { mapState } from "vuex"
   export default {
    data() {
      return {
        isCollapse: false
      };
    },
    computed: {
      ...mapState(['userInfo','menuList'])
    },
    components: {
      subMenu
    },
    mounted() {
    },
    methods: {
      quit() {
        localStorage.removeItem("wf-token")
        localStorage.removeItem("wf-userInfo")
        this.$router.push("/login")
        window.location.reload()
      },
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
    }
  }
</script>
<style scoped>
 .icon-shouqi {
    color: #fff;
    font-size:30px;
    cursor: pointer;
    margin-right: 50px;
  }
  .quit {
    cursor: pointer;
    color: red;
  }

  .el-avatar{
    vertical-align: middle;
    margin-right: 10px;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 60px;
  }
  .row-bg {
    background-color: #4B63FC;
  }
  .el-header {
    background-color: #4B63FC;
    color: #333;
    text-align: center;
    line-height: 55px;
  }
  .el-main {
    background-color:#fff;
    color: #333;
    text-align: center;
    line-height: 160px;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
    .el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
</style>
